<?php
Cinnamon::loadClass('UIComponent');

/**
 * DataGridColumn class
 *
 * A column of the data grid component
 * @todo list available properties
 */
class DataGridColumn extends UIComponent {
	/**
	 * Default DataGridColumn constructor
	 *
	 * @param string title the column title
	 */
	public function __construct($title) {
		parent::__construct();
		
		// register properties
		$this->registerProperties('title', 'width', 'field', 'function', 'format');
		
		// initialize properties
		$this->title 	= $title;
		$this->width 	= null;
		$this->function = false;
		$this->field 	= false;
		$this->format 	= false;	
	}
	
	/**
	 * Renders this component
	 */
	public function render() {
		$this->dispatchRenderEvent();
		
		echo '<th>'. $this->__toString() .'</th>';
	}
	
	/**
	 * Returns a human readable string for this object (Magic function)
	 */
	public function __toString() {
		return $this->title;
	}
}

?>